var orgid = RequestURLParam.getParam("orgid");
var cate = RequestURLParam.getParam("cate");
var gridList;
var scName;
$(document).ready(function() {
	gridList = mini.get("gridList");
	gridList.load({
        'sysRole.orgId': orgid,
        'sysRole.orgType': 'org'
	});
});

function formatOper(e) {
	var row = e.record;
	return "<a class='mini-button' hideFocus='' href='javascript:void(0)' onClick='openInf(\"" + e.value + "\")'><span class='mini-button-text  mini-button-icon icon-zoomin'>查看权限</span></a>";
}

function gridrowclick(e) {
	currentgridRow = e.record;
	scName = currentgridRow.roleName;
}

function openInf(fid) {
	mini.open({
		url: "web/base/sysRole/sysRoleInf.html?fid=" + fid + "&cate=" + cate + "&temp=" + new Date().getUTCMilliseconds(),
		title: "查看功能权限",
		width: 700,
		height: 600,
		onload: function() {
			//给对话框传参数！
			var iframe = this.getIFrameEl();
			iframe.contentWindow.SetData("");
		},
		ondestroy: function(e) {
			if(e == "OK") {
				gridList.load({
					'sysRole.srType': 'r'
				});
			}
		}
	});
}

function selRole() {
	var rows = gridList.getSelecteds();
	if(rows || rows.length > 0) {
		var id = [];
		var name = [];
		for(var i = 0; i < rows.length; i++) {
			id.push(rows[i].roleId);
			name.push(rows[i].roleName);
		}
		window.CloseOwnerWindow({
			'id': id.join(","),
			'name': name.join(",")
		});
	} else {
		mini.alert("请勾选角色!");
	}
}